﻿using System;

namespace OracleTools.Core
{
    public class EnvVar
    {
        public static void UpdateValue(string psVariable, string psValue, EnvironmentVariableTarget target)
        {
            string sEnv = Environment.GetEnvironmentVariable(psVariable, target);
            if(sEnv != null) // null if not exists, "" if value is empty
                SetValue(psVariable, psValue, target);
        }

        public static void SetValue(string psVariable, string psValue, EnvironmentVariableTarget target)
        {
            Environment.SetEnvironmentVariable(psVariable, psValue, target);
            LogWriter.LogLine("<{0}> {1} = {2}", target, psVariable, psValue);
        }

    }
}
